﻿// -----------------------------------------------------------------------
// <copyright file="AdPTabsData.cs" company="">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace VDC.VONE.DAL
{
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Data.SqlClient;
    using System.Linq;
    using System.Reflection;
    using System.Text;

    using Microsoft.ApplicationBlocks.Data;

    using VDC.COMMON;
    using VDC.VONE.ENTITIES;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public class AdPTabsData
    {

        public bool CheckValidRole(string url, int userId, int departmentId, int positionId)
        {
            string methodName = MethodBase.GetCurrentMethod().DeclaringType.ToString() + Constants.Dot + MethodBase.GetCurrentMethod().Name;
            LogHelper.Instance.WriteInfo(Constants.Begin + methodName);
            try
            {
                SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.ConnectionString, Constants.StorepProcedure.VOneCheckRole, url, userId, departmentId, positionId);
                return reader.HasRows;
            }
            catch (SqlException ex)
            {
                LogHelper.Instance.WriteError(methodName + Constants.Colon + ex.Message);
                throw new Exception(ex.ToString());
            }
        }
    }
}
